<template>
	<view class="">
		<u-input placeholder="" clearable style="background-color:#fff;border: none;height: 100rpx;" v-model="nickname"
			:type="type" :border="border" />
	</view>
</template>

<script>
	export default {
		data() {
			return {
				nickname: "",
				value: '',
				type: 'text',
				border: true
			}
		},
		onShow() {
			this.$http('api/user/userInfo').then(res => {
				this.userInfo = res;
				console.log(res);
				this.nickname = res.nick_name
				console.log(this.nickname);
			});


		},
		methods: {
			init() {
				this.$http('api/user/userInfo').then(res => {
					this.info = res;
					console.log(this.info.nick_name);

				})
			},
			onNavigationBarButtonTap() {
				// this.init();
				console.log(this.nickname);
				setTimeout(() => {
					uni.navigateTo({
						url: './editUser'
					})
				}, 1000)
				this.$http('api/user/editUserInfo', {
					nick_name: this.nickname,
					head_image:''
				}, "POST").then(res => {
					uni.showToast({
						title: "修改成功!"
					})
					this.init();
				})


			},
		}
	}
</script>

<style lang="less" scoped>
	page {
		background-color: #FAFAFA;
	}
</style>
